<?php
namespace ZN\VariableTypes;

class __USE_STATIC_ACCESS__Stack
{
	//----------------------------------------------------------------------------------------------------
	//
	// Yazar      : Ozan UYKUN <ozanbote@windowslive.com> | <ozanbote@gmail.com>
	// Site       : www.zntr.net
	// Lisans     : The MIT License
	// Telif Hakkı: Copyright (c) 2012-2016, zntr.net
	//
	//----------------------------------------------------------------------------------------------------
	
	//----------------------------------------------------------------------------------------------------
	// Protected Data
	//----------------------------------------------------------------------------------------------------
	// 
	// @var string
	//
	//----------------------------------------------------------------------------------------------------
	protected $data = '';
	
	//----------------------------------------------------------------------------------------------------
	// Call Undefined Method                                                                       
	//----------------------------------------------------------------------------------------------------
	//
	// __call()
	//																						  
	//----------------------------------------------------------------------------------------------------
	use \CallUndefinedMethodTrait;
	
	//----------------------------------------------------------------------------------------------------
	// Error Control
	//----------------------------------------------------------------------------------------------------
	// 
	// $error
	// $success
	//
	// error()
	// success()
	//
	//----------------------------------------------------------------------------------------------------
	use \ErrorControlTrait;
	
	//----------------------------------------------------------------------------------------------------
	// Data
	//----------------------------------------------------------------------------------------------------
	// 
	// @param string $data
	//
	//----------------------------------------------------------------------------------------------------
	public function data($data = '')
	{
		if( ! is_string($data) ) 
		{
			return \Errors::set('Error', 'stringParameter', '1.(data)');
		}
		
		$this->data = $data;
		
		return $this;
	}	
	
	//----------------------------------------------------------------------------------------------------
	// mtrim
	//----------------------------------------------------------------------------------------------------
	// 
	// @param void
	//
	//----------------------------------------------------------------------------------------------------
	public function mtrim()
	{
		 $this->data = \Strings::mtrim($this->data);
		 
		 return $this;
	}	
	
	//----------------------------------------------------------------------------------------------------
	// Trim Slashes
	//----------------------------------------------------------------------------------------------------
	// 
	// @param void
	//
	//----------------------------------------------------------------------------------------------------
	public function trimSlashes()
	{
		$this->data = \Strings::trimSlashes($this->data);
		
		return $this;
	}	
	
	//----------------------------------------------------------------------------------------------------
	// Casing
	//----------------------------------------------------------------------------------------------------
	// 
	// @param string $type lower, upper, title
	// @param string $encoding
	//
	//----------------------------------------------------------------------------------------------------
	public function casing($type = 'lower', $encoding = "utf-8")
	{
		$this->data = \Strings::casing($this->data, $type, $encoding);
		
		return $this;
	}

	//----------------------------------------------------------------------------------------------------
	// Upper Case
	//----------------------------------------------------------------------------------------------------
	// 
	// @param string $encoding
	//
	//----------------------------------------------------------------------------------------------------
	public function upperCase($encoding = 'utf-8')
	{
		$this->data = \Strings::upperCase($this->data, $encoding);
		
		return $this;
	}	

	//----------------------------------------------------------------------------------------------------
	// Lower Case
	//----------------------------------------------------------------------------------------------------
	// 
	// @param string $encoding
	//
	//----------------------------------------------------------------------------------------------------
	public function lowerCase($encoding = 'utf-8')
	{
		$this->data = \Strings::lowerCase($this->data, $encoding);
		
		return $this;
	}	

	//----------------------------------------------------------------------------------------------------
	// Title Case
	//----------------------------------------------------------------------------------------------------
	// 
	// @param string $encoding
	//
	//----------------------------------------------------------------------------------------------------
	public function titleCase($encoding = 'utf-8')
	{
		$this->data = \Strings::titleCase($this->data, $encoding);
		
		return $this;
	}
	
	//----------------------------------------------------------------------------------------------------
	// Camel Case
	//----------------------------------------------------------------------------------------------------
	// 
	// @param void
	//
	//----------------------------------------------------------------------------------------------------
	public function camelCase()
	{
		$this->data = \Strings::camelCase($this->data);
		
		return $this;
	}	
	
	//----------------------------------------------------------------------------------------------------
	// Pascal Case
	//----------------------------------------------------------------------------------------------------
	// 
	// @param void
	//
	//----------------------------------------------------------------------------------------------------
	public function pascalCase()
	{
		$this->data = \Strings::pascalCase($this->data);
		
		return $this;
	}

	//----------------------------------------------------------------------------------------------------
	// Section
	//----------------------------------------------------------------------------------------------------
	// 
	// @param void
	//
	//----------------------------------------------------------------------------------------------------
	public function section($starting = 0, $count = NULL, $encoding = "utf-8")
	{
		$this->data = \Strings::section($this->data, $starting, $count, $encoding);
		
		return $this;
	}	

	//----------------------------------------------------------------------------------------------------
	// Search
	//----------------------------------------------------------------------------------------------------
	// 
	// @param string $needle
	// @param string $type
	// @param string $case
	//
	//----------------------------------------------------------------------------------------------------
	public function search($needle = '', $type = "str", $case = true)
	{
		$this->data = \Strings::search($this->data, $needle, $type, $case);
		
		return $this;
	}	

	//----------------------------------------------------------------------------------------------------
	// Reshuffle
	//----------------------------------------------------------------------------------------------------
	// 
	// @param string $shuffle
	// @param string $reshuffle
	//
	//----------------------------------------------------------------------------------------------------
	public function reshuffle($shuffle = '', $reshuffle = '')
	{
		$this->data = \Strings::reshuffle($this->data, $shuffle, $reshuffle);
		
		return $this;
	}	

	//----------------------------------------------------------------------------------------------------
	// Recurrent Count
	//----------------------------------------------------------------------------------------------------
	// 
	// @param string $char
	//
	//----------------------------------------------------------------------------------------------------
	public function recurrentCount($char = '')
	{
		$this->data = \Strings::recurrentCount($this->data, $char);
		
		return $this;
	}	

	//----------------------------------------------------------------------------------------------------
	// Placement
	//----------------------------------------------------------------------------------------------------
	// 
	// @param string $delimiter
	// @param array  $array
	//
	//----------------------------------------------------------------------------------------------------
	public function placement($delimiter = '?', $array = [])
	{
		$this->data = \Strings::placement($this->data, $delimiter, $array);
		
		return $this;
	}	
	
	//----------------------------------------------------------------------------------------------------
	// Replace
	//----------------------------------------------------------------------------------------------------
	// 
	// @param string $delimiter
	// @param array  $array
	//
	//----------------------------------------------------------------------------------------------------
	public function replace($oldChar = '', $newChar = '', $case = true)
	{
		$this->data = \Strings::replace($this->data, $oldChar, $newChar, $case);
		
		return $this;
	}
	
	//----------------------------------------------------------------------------------------------------
	// To Char
	//----------------------------------------------------------------------------------------------------
	// 
	// @param void
	//
	//----------------------------------------------------------------------------------------------------
	public function toChar()
	{
		$this->data = \Strings::toChar($this->data);
		
		return $this;
	}
	
	//----------------------------------------------------------------------------------------------------
	// To Ascii
	//----------------------------------------------------------------------------------------------------
	// 
	// @param void
	//
	//----------------------------------------------------------------------------------------------------
	public function toAscii()
	{
		$this->data = \Strings::toAscii($this->data);
		
		return $this;
	}
	
	//----------------------------------------------------------------------------------------------------
	// Add Slashes
	//----------------------------------------------------------------------------------------------------
	// 
	// @param string $addDifferentChars
	//
	//----------------------------------------------------------------------------------------------------
	public function addSlashes($addDifferentChars = '')
	{
		$this->data = \Strings::addSlashes($this->data, $addDifferentChars);
		
		return $this;
	}
	
	//----------------------------------------------------------------------------------------------------
	// Remove Slashes
	//----------------------------------------------------------------------------------------------------
	// 
	// @param void
	//
	//----------------------------------------------------------------------------------------------------
	public function removeSlashes()
	{
		$this->data = \Strings::removeSlashes($this->data);
		
		return $this;
	}
	
	//----------------------------------------------------------------------------------------------------
	// Length
	//----------------------------------------------------------------------------------------------------
	// 
	// @param string $encoding
	//
	//----------------------------------------------------------------------------------------------------
	public function length($encoding = 'utf-8')
	{
		$this->data = \Strings::length($this->data, $encoding);
		
		return $this;
	}
	
	//----------------------------------------------------------------------------------------------------
	// Encode
	//----------------------------------------------------------------------------------------------------
	// 
	// @param string $salt
	//
	//----------------------------------------------------------------------------------------------------
	public function encode($salt = 'secure')
	{
		$this->data = \Strings::encode($this->data, $salt);
		
		return $this;
	}
	
	//----------------------------------------------------------------------------------------------------
	// Repeat
	//----------------------------------------------------------------------------------------------------
	// 
	// @param numeric $count
	//
	//----------------------------------------------------------------------------------------------------
	public function repeat($count = 1)
	{
		$this->data = \Strings::repeat($this->data, $count);
		
		return $this;
	}
	
	//----------------------------------------------------------------------------------------------------
	// Pad
	//----------------------------------------------------------------------------------------------------
	// 
	// @param numeric $count
	// @param string  $chars
	// @param string  $type
	//
	//----------------------------------------------------------------------------------------------------
	public function pad($count = 1, $chars = ' ', $type = 'right')
	{
		$this->data = \Strings::pad($this->data, $count, $chars, $type);
			
		return $this;
	}
	
	//----------------------------------------------------------------------------------------------------
	// Apportion
	//----------------------------------------------------------------------------------------------------
	// 
	// @param numeric $length
	// @param string  $end
	//
	//----------------------------------------------------------------------------------------------------
	public function apportion($length = 76, $end = "\r\n")
	{
		$this->data = \Strings::apportion($this->data, $length, $end);
			
		return $this;
	}
	
	//----------------------------------------------------------------------------------------------------
	// Divide
	//----------------------------------------------------------------------------------------------------
	// 
	// @param string  $seperator
	// @param numeric $index
	//
	//----------------------------------------------------------------------------------------------------
	public function divide($separator = "|", $index = 0)
	{
		$this->data = \Strings::divide($this->data, $separator, $index);
			
		return $this;
	}
	
	//----------------------------------------------------------------------------------------------------
	// Get
	//----------------------------------------------------------------------------------------------------
	// 
	// @param  void
	// @return string
	//
	//----------------------------------------------------------------------------------------------------
	public function get()
	{
		$data = $this->data;
		
		$this->data = '';
		
		return $data;
	}
}